import Vue from "vue";
import VueRouter from 'vue-router'
import AboutPage from "@/components/AboutPage.vue";
import ContactPage from "@/components/ContactPage.vue";
import CooperationPage from "@/components/CooperationPage.vue";
import ChildCompanyPage from "@/components/ChildCompanyPage.vue";
import ShowPage from "@/components/ShowPage.vue";

// 1 使用
Vue.use(VueRouter)

// 2 配置
const routes = [
    {
        path: '/user',
        name: 'user',
        component: ShowPage
    },
    {
        path: '/company/about',
        component: AboutPage,
        children: [
            {
                path: '/company/cooperation',
                component: CooperationPage
            },
            {
                path: '/company/child',
                component: ChildCompanyPage
            }
        ]
    },
    {
        path: '/company/contact',
        component: ContactPage
    },
    {
        path: '/',
        redirect: 'company/about'
    },
]

// 3 实例化并导出
export default new VueRouter({
    routes
})

